// Include this line if you want to use the Fonts, else disable so the program
// does not need the freetype library.
#define BUZZ_USE_FONTS 1

// Can enable/disable the use of SDL_Image.
// If enabled the program will require the SDL Image DLLs etc, but the image
// class will able to load image types other than BMP. e.g. PNG, JPG
#define BUZZ_USE_SDL_IMAGE 0

#include "Buzz.h"

int main(int argc, char *argv[])
{
    // Create graphics window
    Window* window = new Window(320, 240, "Buzz Test", 2);

    // Load an image with a colour key - 0,128,128 (teal)
	Image* image = new Image("Image.bmp", ColourKey(0,128,128));

    // Draw semi transparent & 5 times the size
    image->setAlpha(128);
    image->setScale(5);

    // Load an animation with 3 frames, 300 ms per frame, and teal colour key
	Animation* anim = new Animation("Animation.bmp", 3, 300, ColourKey(0,128,128));

    // Tint green
    //anim->setTints(128,255,128);	// Some features currently disabled for animations

    // Load a font, Verdana, height 20
    Font* f = new Font("verdanab.ttf", 20);

    // Set refernce point on the animation so draws from the bottom left
    anim->setReferencePoint(0, anim->getHeight());

	// Set a default background colour
    window->setBackgroundColour(0,128,128);

    // Loop until the user clicks close on the window
    while(window->isOpen())
    {
        // Rotate the image 5 degrees clockwise
        if(Keyboard::isKeyPressed(SDLK_SPACE)) image->setRotation(image->getRotation() + 5);

        // Draw the image at x=280, y=240
        image->draw(window->getWidth()/2, window->getHeight()/2);

        // Draw the animation flipped at the bottom of the window, x = 340
        anim->draw(200, window->getHeight(), true);

        // Draw some text at x=10, y=30
        f->renderString(10, 30, "Buzz Test Program");

        // Must call window->process to process events, swap buffers etc
        window->process();

        // Sleepy time
        SDL_Delay(10);
    }

	return 0;
}
